<template>
    <div class="home_wrap">
        <div class="left">
            <img src="@/assets/img/logo.png" alt="" srcset="">
            <div class="pingtai">学生信息成绩管理平台</div>
        </div>
        <div class="right">
            <ul class="list">
                <li>常见问题</li>
                <li>安全中心</li>
                <li>客服</li>
                <li @click="goLogin">{{ info }}</li>
                <li @click="exit">退出</li>
            </ul>
        </div>
    </div>
</template>

<script>
export default {
  computed: {
    info() {
      return this.$store.state.user_name ? this.$store.state.user_name : "登录";
    },
  },
  methods: {
    goLogin() {
      console.log("gologin");
      if (!this.$store.state.user_name) {
        this.$router.push({
          name: "login",
        });
      } else {
        this.$router.push({
          name: "personcenter",
        });
      }
    },
    exit() {
      localStorage.clear();
      sessionStorage.clear();
      window.open("about:blank", "_self");
      window.close();
    },
  },
};

</script>

<style lang="less" scoped>
.home_wrap {
  display: flex;
  justify-content: space-between;
  .left {
    display: flex;
    align-items: center;
    img {
      width: 100px;
      height: 100px;
    }
    .pingtai {
      font-size: 30px;
      font-weight: 700;
      //   line-height: 130px;
      display: flex;
      align-items: center;
    }
  }
  .right {
    display: flex;
    align-items: flex-end;
    .list {
      display: flex;
      li {
        padding-right: 10px;
        padding-bottom: 10px;
      }
    }
  }
}
</style>